package com.jacken.springcloudseatabank02.controller;

import com.jacken.springcloudseatabank02.entity.basic.Result;
import com.jacken.springcloudseatabank02.service.IAccountService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author wangqiang
 * @version 1.0
 * @date 2020/10/8 10:25
 */
@RestController
@AllArgsConstructor
public class TransferController {



    private final IAccountService accountService;


    /**
     * 转账接收方
     *
     * @param otherAccountNo      账户
     * @param accountBalance 金额
     * @return Result
     */
    @GetMapping("/bank2/transfer")
    public Result transfer(@RequestParam("otherAccountNo") String otherAccountNo,@RequestParam("accountBalance") Double accountBalance) {
        accountService.updateAccountBalance(otherAccountNo, accountBalance);
        return Result.success();
    }
}
